{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Make a Volume from a numpy object\n",
    "#\n",
    "import numpy as np\n",
    "from vedo import *\n",
    "#embedWindow('itkwidgets') # backends are: itkwidgets, k3d or False\n",
    "\n",
    "X, Y, Z = np.mgrid[:30, :30, :30]\n",
    "# scaled distance from the center at (15, 15, 15)\n",
    "scalar_field = ((X-15)**2 + (Y-15)**2 + (Z-15)**2)/225/3\n",
    "print('scalar min, max =', np.min(scalar_field), np.max(scalar_field))\n",
    "\n",
    "vol = Volume(scalar_field)\n",
    "lego = vol.legosurface(vmin=.3, vmax=.6)\n",
    "\n",
    "#show(vol.c('magma'))\n",
    "show(lego)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
